<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>小丫客服</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="email=no"/>
<meta name="format-detection" content="address=no"/>
<link href="__PUBLIC__/css/base.css" rel="stylesheet"/>
<link href="__PUBLIC__/css/service.css" rel="stylesheet"/>
</head>
<body class="huibg">
<!---  头部开始  -->
<div class="top clearfix">
	<div class="icon_left"></div>
	<div class="icon_right"></div>
</div>
<!---  头部结束  -->
<div class="service cssss"> 
	<div class="list">
		<div class="box">
			<img src="__PUBLIC__/img/pic/head_02.png" />
			<p><i></i>您好，亲请问有什么可以帮到您的？</p>
		</div>
		<div class="box1">
			<img src="__PUBLIC__/img/pic/head_02.png" />
			<p><i></i>您好，亲请问有什么可以帮到您的？</p>
		</div>
		<!--<div class="time"><span>15:20</span></div>-->
	</div>
	<div class="sen_box">
		<input type="text">
		<a class="send_btn">发送</a>
	</div>
</div>
</body>
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/comm.js"></script>
<script>
var headImg="{$user.headimg}";
$(function(){
$(".list").css({"height":parseInt($(window).height()-$(".top").height()-$(".send_box").height())+"px"})
$(".list").scrollTop($(".list")[0].scrollHeight);
})
function getlist(){
	var new_element;
	$.get('__URL__/service_page',{
	},function(e){
		$.each(e,function(k,v){
			if(v.service_id==0){
				new_element='<div class="box1">'+
					'<img src="'+headImg+'" />'+
					'<p><i></i>'+v.content+'</p>'+
				'</div>';
			}else{
				new_element='<div class="box">'+
					'<img src="__PUBLIC__/img/pic/head_02.png" />'+
					'<p><i></i>'+v.content+'</p>'+
				'</div>';
			}				
			$(".list").append(new_element);
		})		
	})
}
getlist();
var content;
$(".sen_box .send_btn").on("click",function(){
	content=$(".sen_box input").val();
	if(content.length==0){
		alert("输入的内容不能为空");
		return;
	}
	var new_element;
	$.post('__URL__/service_page',{
		content:content
	},function(e){
		if(e.status==1){
			var new_element='<div class="box1">'+
				'<img src="'+headImg+'" />'+
				'<p><i></i>'+content+'</p>'+
			'</div>';
			$(".sen_box input").val("");
			$(".list").append(new_element);
			$(".list").scrollTop($(".list")[0].scrollHeight);
		}else{
			alert(e.msg);
		}
	})
});
</script>
</html>